#include <iostream>
#include "lib.h"

using namespace std;

double simpson(double (*func)(double), double a, double b, int n){
    double x, h, h2, sum;
    
    int j;
    
    h = (b-a)/n;
    
    h2 = h/2;
    
    sum = func(a);
    
    for( j = 0; j < n; j++){
        x = a + j*h;
        sum += 4 * func(x+h2) + 2*func(x+h);
    }
    
    return (sum - func(b))*h2/3;
}


int main()
{
    
    try{
        //getval
        throw "Labas";
        cout << "Hello world!" << endl;
    }
    catch(const char e[]){
        cout << "Error: " << e << endl;
    }
    return 0;
}
